package org.apache.dolphinscheduler.api.controller;

import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.NodeRelationService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static org.apache.dolphinscheduler.api.enums.Status.CHANGE_TASK_INSTANCE_STATE_ERROR;

@RestController
@RequestMapping("/node-relation")
public class NodeRelationController extends BaseController {

    @Autowired
    NodeRelationService nodeRelationService;


    @PostMapping(value = "changeState")
    @ApiException(CHANGE_TASK_INSTANCE_STATE_ERROR)
    public Result<Object> changeState(int nodeId){
       nodeRelationService.changeState(nodeId);
       return  success();
    }
}
